<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link rel="stylesheet" href="../../static/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/css/main.css">
    <link rel="stylesheet" href="../../static/css/public.css">
    <script src="../../static/js/jquery-3.4.1.min.js"></script>
    <script src="../../static/layui/layui.js"></script>
    <style>
        .t {
            width: 100px
        }
    </style>
</head>
<body>
<div class="er">
    <ul class="layui-nav layui-bg-cyan" id="top-nav">
        <li class="layui-nav-item">
            <a href="">首页</a>
        </li>
        <li class="layui-nav-item">
            <a href="">个人中心<span class="layui-badge-dot"></span></a>
        </li>
        <li class="layui-nav-item">
            <a href="#"><img src="../../static/images/2019-08-07/f8aa0870-e4ea-4170-9772-296204476267.jpg"
                             class="layui-nav-img"
                             text="'你好，'+${session.user.username}"></a>

        </li>
        <li class="layui-nav-item">
            <a href="">退出登录</a>

        </li>
    </ul>


</div>
<div class="left">
    <ul class="layui-nav layui-nav-tree  layui-nav-side" lay-filter="test" id="left">
        <li class="layui-nav-item" style="height: 60px"><a href="#" style="font-size:18px;font-family: 'Century Gothic';color: #bce8f1">suda物流系统
            </a></li>
        <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;">物流信息</a>
            <dl class="layui-nav-child">
                <dd><a href="../order/allorder.html" target="_top">订单列表</a></dd>
                <dd><a href="../package/allpackage.html" target="_top">包裹信息</a></dd>
                <dd><a href="../route/allroute.html" target="_top">运输信息</a></dd>
                <dd><a href="../store/allstore.html" target="_top">存储信息</a></dd>
                <dd><a href="../vehicle/allvehicle.html" target="_top">运输工具信息</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;">物流管理</a>
            <dl class="layui-nav-child">
                <dd><a href="../staff/allstaff.html" target="_top">员工列表</a></dd>

                <dd><a href="../warehouse/allwarehouse.html" target="_top">仓库列表</a></dd>

                <dd><a href="../customer/allcustomer.html" target="_top">顾客列表</a></dd>
            </dl>
        </li>
    </ul>

</div>
<div class="body">
    <h2 class="tablename">添加仓库息</h2>
    <hr class="layui-bg-gray">
    <div class="form">
        <br>
        <div class="form">
            <br>
            <form class="layui-form">

                <div class="layui-form-item">
                    <label class="layui-form-label t">仓库编号:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="warehouseId" value="" autocomplete="off" lay-verify="required"
                               class="layui-input">
                    </div>

                    <label class="layui-form-label t">仓库名:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="warehouseName" value="" autocomplete="off" lay-verify="required"
                               class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label t">仓库联系电话:</label>
                        <div class="layui-input-inline">
                            <input type="text" id="warehousePhone" value="" lay-verify="required"
                                   autocomplete="off" class="layui-input stuPassword">

                        </div>

                    </div>


                    <label class="layui-form-label t">仓库地址:</label>
                    <div class="layui-input-inline">
                        <input type="text" id="warehouseAddress" value="" lay-verify="required"
                               autocomplete="off" class="layui-input">
                    </div>

                </div>
                <br>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                        <!--                    <input class="layui-btn layui-btn-radius layui-btn-normal" type="button" onclick="sub()" value="提交">-->
                        <button class="layui-btn layui-btn-radius layui-btn-normal" lay-submit lay-filter="*">添加</button>
                        &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                        <button type="reset" class="layui-btn layui-btn-radius  layui-btn-danger">重置</button>
                    </div>
                </div>
                <br>
            </form>
        </div>
    </div>
</div>
<div class="layui-footer" style="margin-top: 75px">
    <!-- 底部固定区域 -->
    <div class="bottom_left">
        <ul class="ul1">
            <li><a href="javascript:;">首页&nbsp;&nbsp;|&nbsp;</a></li>
            <li><a href="javascript:;">站点情况&nbsp;&nbsp;|&nbsp;</a></li>
            <li><a href="javascript:;">物流信息&nbsp;&nbsp;|&nbsp;</a></li>
            <li><a href="javascript:;">物流管理&nbsp;&nbsp;|&nbsp;</a></li>
            <li><a href="javascript:;">操作管理&nbsp;&nbsp;|&nbsp;</a></li>
            <li><a href="javascript:;">权限管理</a></li>

        </ul>
        <br> <br>
        <p>版权所有 Copyright &copy; 2021 皖ICP@Sun_Wangping</p>
        <p>技术支持： braisedPanda</p>
        <br>
    </div>

</div>

<script>

        layui.use('element', function () {
            var element = layui.element;

            //…
        });

        layui.use(['form', 'layedit', 'laydate'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate;
            
            form.on('submit(*)', function () {
                var warehousesubmit = {
                    "warehouseName": document.getElementById('warehouseName').value,
                    "warehousePhone": document.getElementById('warehousePhone').value,
                    "warehouseId": document.getElementById('warehouseId').value,
                    "warehouseAddress": document.getElementById('warehouseAddress').value,
                }
                layer.confirm('确定添加吗？', {
                    btn: ['是的', '取消'] //按钮
                }, function () {
                    $.ajax({
                        url: 'http://localhost:8080/warehouse',
                        type: 'POST',
                        contentType: 'application/json',
                        dataType: 'json',
                        data: JSON.stringify(warehousesubmit),
                        success(res) {
                            var obj = JSON.stringify(res);

                            // alert(Object.keys(obj)[0]);
                            if (Object.keys(obj)[0] == 0) layer.msg("添加成功", {icon: '1', time: 2000});
                            else layer.msg("添加失败", {icon: '2', time: 2000});
                        },
                        error() {
                            layer.msg('500！', {
                                time: 1000, //不自动关闭
                                icon: 'layui-icon-ok',
                            });
                        }
                    })
                }, function () {
                    layer.msg('已取消', {
                        time: 2000
                    });
                });
                return false;
            })


        });
    </script>
</body>
</html>